package com.dalin.demo.controller;


import com.dalin.system.pojo.entity.SystemUserEntity;
import com.dalin.system.service.SystemUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;


@RestController
@RequestMapping("/api/system")
@CrossOrigin(origins = "*")
public class SystemController {
    @Autowired
    private SystemUserService systemUserService;
    @PostMapping("/login")
    public Boolean login(@RequestBody Map<String,String> boby) throws Exception {
        System.out.println("login 中map=="+boby);
        String loginName = boby.get("loginName");
        String loginPswd = boby.get("password");
        SystemUserEntity user =  systemUserService.findByUsername(loginName, loginPswd);
        System.out.println(loginPswd);
        if (user != null && (user.getLoginPswd().equals(loginPswd))){
            return true;
        }
        return false;
    }
}